<%
=begin
apps: airflow, apache, cassandra, consul, dataplatform-bp1, dataplatform-bp2, dokuwiki, drupal, elasticsearch, geode, jenkins, joomla, kiam, kibana, logstash, magento, mariadb, mariadb-galera, mediawiki, memcached, mongodb, mongodb-sharded, moodle, mysql, nats, nginx, opencart, orangehrm, osclass, owncloud, phabricator, phpbb, phpmyadmin, postgresql, postgresql-ha, prestashop, redis, redis-cluster, suitecrm, tensorflow-resnet, testlink, wavefront, wordpress
platforms: kubernetes, tanzu-application-catalog
id: enable_metrics
title: Enable metrics
category: administration
weight: 40
highlight: 40
=end %>

The chart can optionally start a sidecar metrics exporter for [Prometheus](https://prometheus.io/). The metrics endpoint is exposed in the service.

<% if current.app == 'dataplatform-bp1' || current.app == 'dataplatform-bp2' %>
To start the sidecar Prometheus exporter, set the *metrics.enabled* parameter to *true* in the sub-chart parameters when deploying the chart. Refer to the sub-chart parameters for the default port number.
<% else %>
To start the sidecar Prometheus exporter, set the *metrics.enabled* parameter to *true* when deploying the chart. Refer to the chart parameters for the default port number.
<% end %>

Metrics can be scraped from within the cluster using any of the following approaches:

* Adding the required annotations for Prometheus to discover the metrics endpoints, as in the example below:

        podAnnotations:
          prometheus.io/scrape: "true"
          prometheus.io/path: "/metrics/cluster"
          prometheus.io/port: "9000"

* Creating a ServiceMonitor or PodMonitor entry (when the Prometheus Operator is available in the cluster)
* Using something similar to the [example Prometheus scrape configuration](https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml).

If metrics are to be scraped from outside the cluster, the Kubernetes API proxy can be utilized to access the endpoint.
